home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
sos3-2.lha
/
src
/
agg
/
Association.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-23
|
3KB
|
78 lines
/* --------------------------------------------------------------------------
* Copyright 1992 by Forschungszentrum Informatik (FZI)
*
* You can use and distribute this software under the terms of the licence
* you should have received along with this program.
* If not or if you want additional information, write to
* Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
* D-7500 Karlsruhe 1, Germany.
* --------------------------------------------------------------------------
*/
// **************************************************************************
// Module Association 06/09/90 Juergen Uhl (ju)
//
// **************************************************************************
// implements methods of classes: Association
// **************************************************************************
#include "sys.h"
#include "agg_err.h"
#include "trc_agg.h"
#include "agg_sos.h"
// **************************************************************************
sos_Bool sos_Object_sos_Object_Association::is_role1 (sos_Object o)
// **************************************************************************
{
// The function tests if an object is an element of the aggregate.
// The test may be based on equality or identity, depending on
// the value of the "role1_based_on_equal" attribute.
T_PROC ("sos_Object_sos_Object_Association::is_role1");
TT (agg_H, T_ENTER);
sos_Bool result = FALSE;
sos_Object_sos_Object_Association a = self;
sos_Bool based_on_equal = self.get_role1_based_on_equal();
agg_iterate_association (a, sos_Object role1, sos_Object role2)
{ if (agg_same_entity (o, role1, based_on_equal, EQ_STRONG))
{ result = TRUE;
break;
}
}
agg_iterate_association_end (a, role1, role2);
TT (agg_H, T_LEAVE);
return result;
} // ** is_role1 **
// **************************************************************************
sos_Bool sos_Object_sos_Object_Association::is_role2 (sos_Object o)
// **************************************************************************
{
// The function tests if an object is an element of the aggregate.
// The test may be based on equality or identity, depending on
// the value of the "role2_based_on_equal" attribute.
T_PROC ("sos_Object_sos_Object_Association::is_role2");
TT (agg_H, T_ENTER);
sos_Bool result = FALSE;
sos_Object_sos_Object_Association a = self;
sos_Bool based_on_equal = self.get_role2_based_on_equal();
agg_iterate_association (a, sos_Object role1, sos_Object role2)
{ if (agg_same_entity (o, role2, based_on_equal, EQ_STRONG))
{ result = TRUE;
break;
}
}
agg_iterate_association_end (a, role1, role2);
TT (agg_H, T_LEAVE);
return result;
} // ** is_role2 **